package com.harvest.scientific.ladder.net

import com.harvest.scientific.ladder.util.ApUtil
import com.harvest.scientific.ladder.util.DeUtil
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response
import java.io.IOException

/**
 * @Author: 633578
 * @Desc: 拦截器
 */
class BaCeptor : Interceptor {

    companion object {
        const val TAG = "BaCeptor"
    }

    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        val currentTimeMillis = System.currentTimeMillis()
        val request = chain.request()

        val builder: Request.Builder = request.newBuilder()
            .addHeader("pleasantCancerEverybody", "287")
            .addHeader("naturalPardonSmallBuddhism", "")
            .addHeader("freezingSaleswomanFurnishedDuckling", "")
            .addHeader("unsafeProbableFog", "")
            .addHeader("bestNobodyScientificAvenueCruelThursday", "googleplay")
            .addHeader("interestingSaturdayEntireYesterdayBasin", ApUtil.getVersionName())
            .addHeader("undergroundBentRadioClock", ApUtil.getVersionCode())
            .addHeader("scottishCustomBehaviour", "${DeUtil.getDeviceId()}")
            .addHeader("seniorStationHopelessPhotographerBurial", "${DeUtil.getDeviceId()}")
            .addHeader("merryTiresomeBedclothes", "${DeUtil.getDeviceId()}")
            .addHeader("undergroundMedicalPlayroomProfessor", "1")
            .addHeader("highFullLeague", "true")

        try {
            return chain.proceed(builder.build())
        } catch (e: Exception) {
            throw e
        }
    }
}